<!doctype html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../assert_selection.js"></script>
<script>
// This test file records current behavior. We're not sure whether current
// behaviors are correct, disired or not.
// See http://crbug.com/832549 for details
selection_test(
  [
    '<div contenteditable>',
      '<div>',
        'before',
        '<table><tbody>',
          '<tr><td>^1</td><td>2</td><td>3</td></tr>',
          '<tr><td>4</td><td>5</td><td>6</td></tr>',
          '<tr><td>7</td><td>8</td><td>9|</td></tr>',
        '</tbody></table>',
        'after',
      '</div>',
    '</div>',
  ],
  'delete',
  '<div contenteditable>before<br>|after</div>',
  '1-1. Delete inside TABLE to end of last cell in TABLE');

selection_test(
  [
    '<div contenteditable>',
      '<div>',
        'before',
        '<table><tbody>',
          '<tr><td>^1</td><td>2</td><td>3</td></tr>',
          '<tr><td>4</td><td>5</td><td>6</td></tr>',
          '<tr><td>7</td><td>8</td><td>9</td></tr>',
        '</tbody></table>',
        '|after',
      '</div>',
    '</div>',
  ],
  'delete',
  '<div contenteditable><div>before|after</div></div>',
  '1-2. Delete inside TABLE to end ofTABLE');

selection_test(
  [
    '<div contenteditable>',
      '<div>',
        'before^',
        '<table><tbody>',
          '<tr><td>1</td><td>2</td><td>3</td></tr>',
          '<tr><td>4</td><td>5</td><td>6</td></tr>',
          '<tr><td>7</td><td>8</td><td>9</td></tr>',
        '</tbody></table>',
        'after|',
      '</div>',
    '</div>',
  ],
  'delete',
  '<div contenteditable><div>before|</div></div>',
  '2. Delete before TABLE to text after TABLE');


selection_test(
  [
    '<div contenteditable>',
      '<div>',
        '^before',
        '<table><tbody>',
          '<tr><td>1</td><td>2</td><td>3</td></tr>',
          '<tr><td>4</td><td>5</td><td>6</td></tr>',
          '<tr><td>7</td><td>8</td><td>9|</td></tr>',
        '</tbody></table>',
        'after',
      '</div>',
    '</div>',
  ],
  'delete',
  // TODO(editing-dev): Should we locate caret before BR?
  '<div contenteditable><br>|after</div>',
  '3. Delete text before TABLE to end of last cell in TABLE.');
</script>
